🧪 Add test for hyphens in urls plugin#224
Conversation
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
There was a problem hiding this comment.
Code Review
This pull request introduces a new PHPUnit test class, HyphensInUrlsPluginTest, to verify the behavior of the hyphens-in-urls plugin. The feedback recommends adding a tearDown method to unregister the global filter added by the plugin, ensuring proper test isolation and preventing potential test pollution in subsequent test runs.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| protected function setUp(): void { | ||
| parent::setUp(); | ||
| require_once dirname( dirname( dirname( __DIR__ ) ) ) . '/user/plugins/hyphens-in-urls/plugin.php'; | ||
| } |
There was a problem hiding this comment.
Loading the plugin file via require_once registers the ozh_hyphen_in_charset filter globally. Since PHPUnit runs tests in the same process, this filter will persist and affect subsequent tests, leading to potential test pollution and unexpected failures in other test suites.
To ensure proper test isolation, we should clean up and remove the registered filter in the tearDown() method.
protected function setUp(): void {
parent::setUp();
require_once dirname( dirname( dirname( __DIR__ ) ) ) . '/user/plugins/hyphens-in-urls/plugin.php';
}
protected function tearDown(): void {
yourls_remove_filter( 'get_shorturl_charset', 'ozh_hyphen_in_charset' );
parent::tearDown();
}
🎯 What: The
ozh_hyphen_in_charsetfunction in thehyphens-in-urlsplugin was untested.📊 Coverage: The happy path and edge cases (like empty strings) for the target function are now covered.
✨ Result: The test suite now correctly asserts that a hyphen
-is appended to the input.PR created automatically by Jules for task 141920729589512018 started by @projectedanx